﻿@using System.Collections.Generic;
@using hc.epm.DataModel.Business;
@model List<EPM_UnconventionalWork>
@{
    Layout = "~/Views/Shared/_LayoutDialog.cshtml";
}
<div class="contentData">
    <div>
        <table class="datalist" style="word-break:break-all;word-wrap:break-word">
            <thead>
                <tr>
                    <th width="150">具体要求</th>
                    <th width="50">得分</th>
                </tr>
            </thead>
            <tbody>
                @{
                    int index = (ViewBag.pageIndex - (ViewBag.pageIndex - 1)) * ((ViewBag.pageIndex - 1) * 10);
                }
                @if (Model != null && Model.Count() > 0)
            {
                foreach (var item in Model)
                {
                    index++;
                        <tr>
                            <td>@item.Name</td>
                            <td>@(item.Score)</td>
                        </tr>
                    }
                }
                else {
                    <tr>
                        <td colspan="10" class="table-center">
                            暂无数据
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
    <div id="page" style="text-align:right; margin-right:5px;">
    </div>
</div>
@section scripts
    {
    <script>

        //若无数据隐藏分页组件
        if ('@ViewBag.Total' == 0) {
            $("#page").hide();
        }
        layui.use(['layer', 'form', 'element', 'laypage'], function () {
            var layer = layui.layer, form = layui.form, element = layui.element, $ = layui.jquery, laypage = layui.laypage;
            //分页
            laypage.render({
                elem: 'page',
                count: '@ViewBag.Total',
                curr: '@ViewBag.pageIndex',
                layout: ['prev', 'page', 'next', 'skip', 'count'],
                jump: function (obj, first) {
                    if (!first) {
                        //得到了当前页，用于向服务端请求对应数据
                        var curr = obj.curr;
                        var search = $("form").serialize();
                        window.location.href = "/Monitor/IndexWorkItem?pageIndex=" + curr + "&" + search;
                    }
                }
            });
        });
    </script>
}